#!/user/bin/env node

const log = console.log,
      fs = require('fs');
let src,s,lnk;
try{
  if(process.argv.length == 4){
    src = process.argv[2];
    lnk = process.argv[3];
    fs.linkSync(src,lnk);
    console.log('硬链接成功');
    process.exit(2);
  }else if(process.argv.length == 5){
    s = process.argv[3];
    src = process.argv[2];
    lnk = process.argv[4];
     if(process.argv[3] === '-s'){
      fs.symlinkSync(src,lnk);
      console.log('符号链接成功');
      process.exit(3);
     }else{
       console.log(`${s}输入非法！`);
       process.exit(4);
     }
  } 
}catch(e){
  console.error(e.message);
  process.exit(1);
}




      

